/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package registry;

import java.util.List;
import registry.RegistryEvents.ServerAddedEvent;
import shared.FileInfo;
import shared.ServerInfo;

/**
 *
 * @author 1506-37
 */
public class ConsoleOutput implements RegistryListener{

    public void serverAdded(ServerAddedEvent info) {
        ServerInfo serverInfo = info.getInfo();
        System.out.println("Server Info Received: ");
        System.out.println("Server Name: " + serverInfo.getAddress().getHostName());
        System.out.println("TCP File Transfer Port: " + serverInfo.getPort());
        System.out.println("Server Address: " + serverInfo.getAddress());
        System.out.println("Files on " +serverInfo.getAddress().getHostName() +":");
        List<FileInfo> fileList = serverInfo.getFileList();
        for (FileInfo file : fileList)
            System.out.println("\t"+file.getFileName() + " Size : " + file.getFileSize());

    }

}
